Release 10.1A: OpenEdge Development:
.NET Open Clients


Non-persistent Procedure Sample

Example 8–8 is a non-persistent procedure, AddCustomer.p:

Example 8–8: Sample non-persistent procedure 4GL for the OpenAPI
DEFINE INPUT PARAMETER CustName AS CHARACTER. 
DEFINE INPUT PARAMETER phone AS CHARACTER. 
DEFINE INPUT PARAMETER email AS CHARACTER. 
DEFINE OUTPUT PARAMETER CustomerNumber AS INTEGER. 

Example 8–9 shows an OpenAPI code to run a non-persistent procedure:

Example 8–9: OpenAPI code to run a non-persistent procedure
namespace BigOrderInfoClient    { 
  using Progress.Open4GL; 
  using Progress.Open4GL.Proxy; 
  public  class samplecode  { 
    public static void NonPersistentProcedure()  { 
      // Connect to the AppServer 
      Connection myConn = new Connection("AppServer://localhost/asbroker2", 
"", "", ""); 
      OpenAppObject openAO = new OpenAppObject(myConn, "mySvc"); 
      // Set Session model for state-free 
      myConn.SessionModel = 1; 
      // Create the parameters 
      System.String CustName = "abc"; 
      System.String phone = "999-555-1234"; 
      System.String email = "me@foo.com"; 
      System.Int32 outValue; 
      // Create a place for RETURN-VALUE 
      System.String retVal; 
      // Create the ParamArray 
      ParamArray parms = new ParamArray(4); 
      // Set up input parameters 
      parms.AddCharacter(0, CustName, ParamArrayMode.INPUT); 
      parms.AddCharacter(1, phone, ParamArrayMode.INPUT); 
      parms.AddCharacter(2, email, ParamArrayMode.INPUT); 
      // Set up Out parameters 
      parms.AddInteger(3, null, ParamArrayMode.OUTPUT); 
      // Run the procedure 
      openAO.RunProc("AddCustomer.p", parms); 
      // Get output parameters - use holder to handle unknown value 
      outValue = (System.Int32)parms.GetOutputParameter(3); 
      // Get RETURN-VALUE. Will return null for AddCustomer() procedure 
      retVal = (System.String)parms.ProcReturnString; 
      openAO.Dispose(); 
  
    } 
  } 
} 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095